import mockProdServerUtils from '../utils/mockUtils'
import { MockMethod } from 'vite-plugin-mock'
import captchaApiConfig from '@/core/captcha/apiconfig/captchaApiConfig'

const timeout = 50

const mockList = [
	// captcha createBase64 接口
	{
		url: captchaApiConfig.createBase64ByAppKey.mockUri,
		method: captchaApiConfig.createBase64ByAppKey.method,
		timeout,
		response: ({ body }: any) => {
			const r1 = {
				data: {
					captchaItemId: 164722669657686016,
					base64Data:
						'',
				},
				code: 0,
				message: '成功',
			}
			const r2 = {
				code: 0,
				message: '成功',
				data: {
					captchaItemId: 164692588604325888,
					base64Data:
						'',
				},
			}
			return Math.floor(Math.random() * 10 + 1) > 5 ? r1 : r2
		},
	},
] as MockMethod[]

mockProdServerUtils.addPriorityMockList(1, ...mockList)
